<template>
  <el-container style="text-align: right; font-size: 12px">
    <el-backtop :bottom="60"></el-backtop>
    <!--********** 头部 -->
    <el-header style="height:auto">
      <e-header></e-header>
      <e-contentFrame> </e-contentFrame>
      <e-contentTag> </e-contentTag>
      <!-- 广告位 -->
      <div class="new-advlocation">
        <e-advertisingSpace> </e-advertisingSpace>
      </div>
    </el-header>
    <!--********** 主体 -->
    <el-main style="height:auto">
      <!-- <div
        class="mo_login"
        v-loading="loading"
        element-loading-text="拼命加载中"
        element-loading-spinner="el-icon-loading"
        element-loading-background="#ffffff"
      > -->
      <div class="mo_login">
        <div class="addbreadcrumb">
          <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/' }"
              >您当前的位置：首页</el-breadcrumb-item
            >
            <el-breadcrumb-item class="textOut">{{
              text_cate_name
            }}</el-breadcrumb-item>
          </el-breadcrumb>
        </div>
        <div class="periphery">
          <div class="choose-serach">
            <div>
              <span class="serach-span">搜索：</span>
              <el-input
                class="serach-input"
                v-model="input"
                placeholder="请输入关键词"
              ></el-input>
              <el-button class="serach-button" type="danger">搜索</el-button>
            </div>
          </div>

          <!-- 推荐项目 -->
          <div class="news-two">
            <div class="two-bottom">
              <div class="bottom-title"><p>最新项目</p></div>
              <div class="bottom-more"><p>更多》</p></div>
            </div>
            <div
              class="two-body"
              v-for="(item, index) in catgory_projects"
              :key="index"
              s
              @click="ToMessageDetails(1, 2)"
            >
              <div class="two-content">
                <div class="content_img_2">
                  <el-image
                    class="img_size"
                    :src="imgurl + item.content_imgs"
                    fit="fill"
                  ></el-image>
                </div>
                <div class="content_text">
                  <div class="content_title textOut">
                    {{ item.content_title }}
                  </div>
                  <div class="content_bridf text_more_Line">
                    {{ item.content_bridf }}
                  </div>
                  <div class="content_data ">
                    <div>{{ item.content_date }}</div>
                    <div>
                      <span>{{ item.company_name }}</span
                      ><span>{{ item.content_position }}</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <!-- <div class="two-body">
              <div class="two-content">
                <div class="content_img_2">
                  <el-image
                    class="img_size"
                    :src="news_1"
                    fit="fill"
                  ></el-image>
                </div>
                <div class="content_text">
                  <div class="content_title textOut">
                    云南省2020年地址灾害合成孔径雷达干涉测量技术检测地址灾害合成孔径雷达干涉测量技术检测地址灾害合成孔径雷达干涉测量技术检测地址1111111111111111111
                  </div>
                  <div class="content_bridf text_more_Line">
                    云南省政府采购招标文件项目2113名称：伽师县******项目5261采购招标项目编号：****************号伽师县4102政府采购中心1653制二○一三年**月**日第一部分投标企业须知前附表第二部分投标云南省求向采购单位提供的货物。2.5服务:系指按合员单位会员证书（5）学仪器设备行业协会会员学仪器设备行业协会22222222222222222222222222222222222会5服
                  </div>
                  <div class="content_data ">
                    <div>2020-06-30</div>
                    <div><span>招标</span><span>昆明</span></div>
                  </div>
                </div>
              </div>
            </div>
            <div class="two-body">
              <div class="two-content">
                <div class="content_img_2">
                  <el-image
                    class="img_size"
                    :src="news_1"
                    fit="fill"
                  ></el-image>
                </div>
                <div class="content_text">
                  <div class="content_title textOut">
                    云南省2020年地址灾害合成孔径雷达干涉测量技术检测地址灾害合成孔径雷达干涉测量技术检测地址灾害合成孔径雷达干涉测量技术检测地址1111111111111111111
                  </div>
                  <div class="content_bridf text_more_Line">
                    云南省政府采购招标文件项目2113名称：伽师县******项目5261采购招标项目编号：****************号伽师县4102政府采购中心1653制二○一三年**月**日第一部分投标企业须知前附表第二部分投标云南省求向采购单位提供的货物。2.5服务:系指按合员单位会员证书（5）学仪器设备行业协会会员学仪器设备行业协会22222222222222222222222222222222222会5服
                  </div>
                  <div class="content_data ">
                    <div>2020-06-30</div>
                    <div><span>招标</span><span>昆明</span></div>
                  </div>
                </div>
              </div>
            </div>
            <div class="two-body">
              <div class="two-content">
                <div class="content_img_2">
                  <el-image
                    class="img_size"
                    :src="news_1"
                    fit="fill"
                  ></el-image>
                </div>
                <div class="content_text">
                  <div class="content_title textOut">
                    云南省2020年地址灾害合成孔径雷达干涉测量技术检测地址灾害合成孔径雷达干涉测量技术检测地址灾害合成孔径雷达干涉测量技术检测地址1111111111111111111
                  </div>
                  <div class="content_bridf text_more_Line">
                    云南省政府采购招标文件项目2113名称：伽师县******项目5261采购招标项目编号：****************号伽师县4102政府采购中心1653制二○一三年**月**日第一部分投标企业须知前附表第二部分投标云南省求向采购单位提供的货物。2.5服务:系指按合员单位会员证书（5）学仪器设备行业协会会员学仪器设备行业协会22222222222222222222222222222222222会5服
                  </div>
                  <div class="content_data ">
                    <div>2020-06-30</div>
                    <div><span>招标</span><span>昆明</span></div>
                  </div>
                </div>
              </div>
            </div>
            <div class="two-body">
              <div class="two-content">
                <div class="content_img_2">
                  <el-image
                    class="img_size"
                    :src="news_1"
                    fit="fill"
                  ></el-image>
                </div>
                <div class="content_text">
                  <div class="content_title textOut">
                    云南省2020年地址灾害合成孔径雷达干涉测量技术检测地址灾害合成孔径雷达干涉测量技术检测地址灾害合成孔径雷达干涉测量技术检测地址1111111111111111111
                  </div>
                  <div class="content_bridf text_more_Line">
                    云南省政府采购招标文件项目2113名称：伽师县******项目5261采购招标项目编号：****************号伽师县4102政府采购中心1653制二○一三年**月**日第一部分投标企业须知前附表第二部分投标云南省求向采购单位提供的货物。2.5服务:系指按合员单位会员证书（5）学仪器设备行业协会会员学仪器设备行业协会22222222222222222222222222222222222会5服
                  </div>
                  <div class="content_data ">
                    <div>2020-06-30</div>
                    <div><span>招标</span><span>昆明</span></div>
                  </div>
                </div>
              </div>
            </div>
            <div class="two-body">
              <div class="two-content">
                <div class="content_img_2">
                  <el-image
                    class="img_size"
                    :src="news_1"
                    fit="fill"
                  ></el-image>
                </div>
                <div class="content_text">
                  <div class="content_title textOut">
                    云南省2020年地址灾害合成孔径雷达干涉测量技术检测地址灾害合成孔径雷达干涉测量技术检测地址灾害合成孔径雷达干涉测量技术检测地址1111111111111111111
                  </div>
                  <div class="content_bridf text_more_Line">
                    云南省政府采购招标文件项目2113名称：伽师县******项目5261采购招标项目编号：****************号伽师县4102政府采购中心1653制二○一三年**月**日第一部分投标企业须知前附表第二部分投标云南省求向采购单位提供的货物。2.5服务:系指按合员单位会员证书（5）学仪器设备行业协会会员学仪器设备行业协会22222222222222222222222222222222222会5服
                  </div>
                  <div class="content_data ">
                    <div>2020-06-30</div>
                    <div><span>招标</span><span>昆明</span></div>
                  </div>
                </div>
              </div>
            </div> -->
          </div>

          <!-- <div v-show="!liststuats" class="no-addlist">
            <div class="no-showimg">
              <el-image :src="topimgsrc" fit="cover"></el-image>
            </div>
            <div class="no_text">
              <p>该分类暂无文章！</p>
            </div>
          </div> -->
          <div class="add_pagination">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="currentPage"
              :page-size="6"
              layout="total,  prev,pager,  next, jumper"
              :total="addTotal"
            >
            </el-pagination>
          </div>
        </div>
      </div>
    </el-main>
    <!--********** 底部 -->
    <el-footer style="height:auto">
      <e-footer></e-footer>
    </el-footer>
  </el-container>
</template>
<script>
import eHeader from "@/components/public/Header.vue";
import eContentFrame from "@/components/public/ContentFrame.vue";
import eContentTag from "@/components/public/ContentTag.vue";
import eAdvertisingSpace from "@/components/public/AdvertisingSpace.vue";
import eFooter from "@/components/public/Footer.vue";

export default {
  components: {
    eHeader,
    eContentFrame,
    eContentTag,
    eAdvertisingSpace,
    eFooter
  },
  data() {
    return {
      imgurl: this.$urls,
      topimgsrc: require("../../assets/images/no_text.jpg"),
      liststuats: false,
      text_cate_name: this.$route.query.name,
      text_title: "",
      text_date: "",
      name: "",
      text_img: "",
      text_content: "",
      rightlist: [],
      addTotal: 0,
      currentPage: 1,
      addId: this.$route.query.id,
      loading: false,
      tabPosition: 0,
      a_catgory_children: [
        { id: 1, name: "基建方案" },
        { id: 2, name: "招标采购" },
        { id: 3, name: "工程项目" },
        { id: 4, name: "机械设备" },
        { id: 5, name: "装饰建材" },
        { id: 6, name: "配送运输" },
        { id: 7, name: "施工队伍" },
        { id: 8, name: "综合服务" },
        { id: 1, name: "基建方案" },
        { id: 2, name: "招标采购" },
        { id: 3, name: "工程项目" },
        { id: 4, name: "机械设备" },
        { id: 5, name: "装饰建材" },
        { id: 6, name: "配送运输" },
        { id: 7, name: "施工队伍" },
        { id: 8, name: "综合服务" },
        { id: 1, name: "基建方案" },
        { id: 2, name: "招标采购" },
        { id: 3, name: "工程项目" },
        { id: 4, name: "机械设备" },
        { id: 5, name: "装饰建材" },
        { id: 6, name: "配送运输" },
        { id: 7, name: "施工队伍" },
        { id: 8, name: "综合服务" }
      ],
      news_1: require("../../assets/images/news_1.png"),
      catgory_projects: []
    };
  },
  created() {
    let textid = sessionStorage.getItem("SearchTextlist");
    this.addId = textid;
    this.text_cate_name = "“" + textid + "”" + "的搜索结果";
    //关键字搜索
    this.PostMesDetials(textid);
    sessionStorage.removeItem("SearchTextlist");
  },
  mounted() {
    window.addEventListener("scroll", this.scrollToTop);
  },
  methods: {
    //分类列表文章
    PostMesDetials(name) {
      let _this = this;
      let Params = {
        keyword: name
      };
      _this.$axios.post(_this.$basis + "/search_all", Params).then(res => {
        let data = res.data.data;
        let resdata = res.data;
        console.log(res);
        _this.catgory_projects = [];
        switch (resdata.code) {
          case 0:
            for (let i = 0; i < data.length; i++) {
              _this.catgory_projects.push({
                id: data[i].id,
                content_title: data[i].title,
                content_bridf: data[i].about,
                content_date: data[i].create_time,
                company_name: data[i].type,
                content_position: data[i].position,
                content_imgs: data[i].imgs
              });
            }
            break;
          case 1:
            console.log(resdata.msg);
            break;
        }
      });
    },
    //类下的子分类列表
    Posta_catgory_children() {
      let _this = this;
      let Params = {
        pid: 1
      };
      _this.$axios
        .post(_this.$basis + "/a_catgory_children", Params)
        .then(res => {
          let data = res.data.data;
          let resdata = res.data;
          _this.a_catgory_children = [];
          //console.log(res);
          switch (resdata.code) {
            case 0:
              for (let i = 0; i < data.length; i++) {
                _this.a_catgory_children.push({
                  id: i,
                  itemid: data[i].id,
                  name: data[i].catgory_name,
                  pid: data[i].pid,
                  level: data[i].level
                });
              }
              break;
            case 1:
              console.log(resdata.msg);
              break;
          }
        });
    },
    //得到文章总数
    getTotal(textid) {
      const _this = this;
      let Url = "/articlelist?cate_id=" + textid + "&page=1&limit=10000";
      let Params = {};
      _this.$https.fetchGet(Url, Params).then(res => {
        let resdata = res.data;
        switch (resdata.code) {
          case 1000:
            let adddata = resdata.data;
            switch (adddata.current_page) {
              case 1:
                let rightdata = adddata.data;
                _this.addTotal = rightdata.length;
                if (_this.addTotal != 0) {
                  _this.liststuats = true;
                } else {
                  _this.liststuats = false;
                }

                for (var i = 0; i < rightdata.length; i++) {
                  _this.text_cate_name = rightdata[i].cate_name;
                }
                break;
            }
            break;
          case 1002:
            break;
        }
      });
    },
    // 文章列表接口
    getMesDetials(textid, page, limit) {
      const _this = this;
      _this.loading = true;
      _this.rightlist = [];

      let Url =
        "/articlelist?cate_id=" + textid + "&page=" + page + "&limit=" + limit;
      let Params = {};
      this.$https.fetchGet(Url, Params).then(res => {
        let resdata = res.data;
        switch (resdata.code) {
          case 1000:
            let adddata = resdata.data;
            switch (adddata.current_page) {
              case 1:
                let rightdata = adddata.data;
                for (var i = 0; i < rightdata.length; i++) {
                  //_this.text_cate_name = rightdata[i].cate_name;
                  _this.rightlist.push({
                    id: rightdata[i].a_id,
                    cate_id: rightdata[i].cate_id,
                    title: rightdata[i].title,
                    text: rightdata[i].seo_keywords,
                    imgsrc: rightdata[i].thumb,
                    name: rightdata[i].name,
                    date: rightdata[i].created_at
                  });
                }
                _this.loading = false;
                //(_this.rightlist)
                break;
            }
            break;
          case 1002:
            _this.loading = false;
            console.log(resdata.msg);
            break;
        }
      });
    },
    //点击分页
    handleSizeChange(val) {},
    handleCurrentChange(val) {
      //this.getMesDetials(this.addId, val, 4);

      let _this = this;
      this.loading = true;
      _this.rightlist = [];
      let Url =
        "/articlelist?cate_id=" + this.addId + "&page=" + val + "&limit=6";
      let Params = {};
      this.$https.fetchGet(Url, Params).then(res => {
        let resdata = res.data;
        switch (resdata.code) {
          case 1000:
            let adddata = resdata.data;
            switch (adddata.current_page) {
              case val:
                let rightdata = adddata.data;
                for (var i = 0; i < rightdata.length; i++) {
                  //_this.text_cate_name = rightdata[i].cate_name;
                  _this.rightlist.push({
                    id: rightdata[i].a_id,
                    cate_id: rightdata[i].cate_id,
                    title: rightdata[i].title,
                    text: rightdata[i].seo_keywords,
                    imgsrc: rightdata[i].thumb,
                    name: rightdata[i].name,
                    date: rightdata[i].created_at
                  });
                }
                this.loading = false;

                break;
            }
            break;
          case 1002:
            this.loading = false;
            console.log(resdata.msg);
            break;
        }
      });
    },
    //跳转文章详情
    ToMessageDetails(textid, cate_id) {
      this.$router.push("/MessageDetails");
      sessionStorage.setItem("Details", textid);
      sessionStorage.setItem("Details_cate_id", cate_id);
    }
  },
  destroyed() {
    window.removeEventListener("scroll", this.scrollToTop);
  }
};
</script>
<style lang="scss" scoped>
.el-container {
  overflow: hidden;
}
.el-main {
  overflow: hidden;
  padding: 0;
}
.new-advlocation {
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 770px;
  height: 260px;
  .adv_container {
    height: 260px;
    .middle-net {
      height: 260px;
    }
  }
}

$font-color: #fff;
$bg-color: rgba(46, 139, 87, 0.4);
$btn-color: #409eff;
$shadow-color: 3px 7px 50px -12px rgba(64, 158, 255, 0.4);
@mixin bubbleAnimation($send1, $send2) {
  animation: bubble $send1 linear infinite,
    direction $send2 ease-in-out infinite alternate;
}
.mo_login {
  position: relative;
  max-width: 1200px;
  width: 100%;
  min-width: 1000px;
  margin: 0 auto;
  margin-top: 25px;
  margin-bottom: 20px;
  height: auto;
  min-height: 635px;

  background: #fbfbfb;
  background-position: left top;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  &:before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    //background-image: linear-gradient(-225deg, #7de2fc 0%, #b9b6e5 100%);
    z-index: -1;
  }
  .addbreadcrumb {
    width: 100%;
    height: 40px;
    font-size: 14px;
    padding: 13px 0 0 22px;
  }
  .periphery {
    width: 100%;
    min-height: 620px;
    height: auto;
    background: #ffffff;
    overflow: hidden;
    .choose-serach {
      display: flex;
      justify-content: flex-start;
      width: 100%;
      height: auto;
      padding-top: 20px;
      padding-bottom: 20px;
      border-bottom: 1px solid #cccccc;
      padding-left: 20px;
      .serach-span {
        width: 56px;
        color: #333333;
        font-size: 18px;
        font-weight: bold;
      }
      .serach-input {
        width: 225px;
        padding-left: 10px;
        padding-right: 15px;
      }
      .serach-button {
        width: 95px;
      }
    }
    .news-two {
      display: flex;
      justify-content: flex-start;
      flex-direction: column;
      width: 100%;
      height: auto;
      min-height: 500px;
      background: #ffffff;
      padding: 20px 20px 20px 20px;
      cursor: pointer;
      .two-bottom {
        display: flex;
        justify-content: space-between;
        width: 100%;
        height: 44px;
        background: #ffffff;
        border-bottom: 2px solid #ee181e;
        .bottom-title {
          width: 106px;
          height: 44px;
          background: #ee181e;
          letter-spacing: 2px;
          font-size: 20px;
          line-height: 44px;
          color: #fefefe;
          text-align: center;
          p {
            width: 100%;
          }
        }
        .bottom-more {
          color: #999999;
          font-size: 16px;
          line-height: 44px;
          cursor: pointer;
        }
      }
      .two-body {
        display: flex;
        justify-content: flex-start;
        flex-direction: column;
        width: 100%;
        height: auto;
        background: #ffffff;
        .two-content {
          display: flex;
          justify-content: flex-start;
          width: 100%;
          height: auto;
          background: #ffffff;
          padding: 20px 0 0 0;
          .content_img_2 {
            width: 100px;
            min-width: 100px;
            height: 100px;
            .img_size {
              width: 100%;
              height: 100%;
            }
          }
          .content_text {
            width: calc(100% - 100px);
            padding: 0 0 1px 10px;
            text-align: left;
            font-size: 16px;
            .content_title {
              width: 100%;
              height: 32px;
              color: #333333;
              font-size: 16px;
              font-weight: bold;
            }
            .content_bridf {
              width: 100%;
              height: auto;
              color: #333333;
              font-size: 14px;
              text-align: left;
            }
            .content_data {
              display: flex;
              justify-content: space-between;
              width: 100%;
              height: auto;
              padding-top: 15px;
              color: #333333;
              font-size: 12px;
              text-align: left;
              span {
                padding-left: 10px;
              }
            }
          }
        }
      }
    }
    .no-addlist {
      width: 164px;
      height: 214px;
      margin: auto;
      margin-top: 186px;
      margin-bottom: 156px;
      .no-showimg {
        width: 100%;
        height: 164px;
        .addimg {
          width: 100%;
          height: 100%;
        }
      }
      .no_text {
        width: 100%;
        height: 22px;
        line-height: 22px;
        margin-top: 28px;
        text-align: center;
        padding-left: 12px;
        color: #999999;
      }
    }
    .add_pagination {
      margin: auto;
      margin-bottom: 20px;
      margin-top: 30px;
      padding: 0 38% 0 20%;
    }
  }
}
.mo_login /deep/ .el-loading-spinner {
  font-size: 30px;
}
</style>
